var REDISSERVER = {
	port: 6379,          // Redis port
	host: 'redis',   // Redis host
	family: 4,           // 4 (IPv4) or 6 (IPv6)
	db: 0
}

var express = require('express')
var app = express()
var bodyParser = require('body-parser')
var Redis = require('ioredis')

var redis = new Redis(REDISSERVER)
app.use(bodyParser.json())
app.post('/', function (req, res) {
	redis.set('config', req.body.data)
	.then(x=>res.send(x))
})

app.get('/', function (req, res) {
	redis.get('config')
	.then(x=>res.send(x))
})

app.listen(3000, function () {
  console.log('Example app listening on port 3000!')
})